package org.moonlight.jvm.instructions.control.ret;

import org.moonlight.jvm.instructions.base.NoOperandsInstruction;
import org.moonlight.jvm.rtda.exclusive.Frame;
import org.moonlight.jvm.rtda.exclusive.Thread;

/**
 * f_return指令: 用于返回 float 的情况
 *
 * @author Moonlight
 * @createTime 2023/9/12 14:16
 **/
public class FReturn extends NoOperandsInstruction {

    @Override
    public void execute(Frame frame) {
        Thread thread = frame.getThread();
        Frame currentFrame = thread.popFrame();
        Frame invokeFrame = thread.topFrame();
        float popFloat = currentFrame.getOperandStack().popFloat();
        invokeFrame.getOperandStack().pushFloat(popFloat);
    }

}
